package com.web.exiaodao.business.constant;

import com.web.exiaodao.business.entity.*;
import com.web.exiaodao.remote.vo.FanliOrderVo;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * 黄金项目中使用到的常量
 *
 * @author zhanglin
 *         date: 2015-12-01 16:41:24
 */
public class JConstant {

    /**
     * 用于常量注释的注解
     * @author duandazhi
     * @date 2017/1/5 下午4:39
     */

    @Target({ElementType.FIELD,ElementType.METHOD})
    @Retention(RetentionPolicy.RUNTIME)
    public @interface ConstantName {
        String value() default "";
    }

    //逗号
    //，,
    public static String SYMBOL_DOT_CN = "，";
    public static String SYMBOL_DOT = ",";
    //分号
    //；;
    public static String SYMBOL_SEMICOLON_CN = "；";
    public static String SYMBOL_SEMICOLON = ";";
    //冒号colon
    //：:
    public static String SYMBOL_COLON_CN = "：";
    public static String SYMBOL_COLON = ":";


    /**
     * 用来方便调试支付宝,微信支付回调地址
     */
    // TODO:打包 2017/1/23
    public static int ENV = 1; //0:公司内网 1:服务器
    public static String SERVER_NAME    = "exiaodao";//服务器名称
    public static String SERVER_ADDRESS = "http://david007.wicp.net:25307/";//服务器名称  http://1.80.219.21:8888/    http://david007.wicp.net:25307/

    //商品详情页面默认显示的评论条数
    public static int  COMMENT_TOP_NUM = 1;
    public static long COMMENT_SUM_SCORE = 5;//评分总分


    /**
     * Boolean类型
     *
     * @author zhanglin
     *         date: 2015-12-01 16:41:24
     */
    public static class BooleanStatus {

        /**
         * 否
         */
        public static final Integer FALSE = 0;

        /**
         * 是
         */
        public static final Integer TRUE = 1;
    }

    /**
     *
     * */
    public static class PayType {
        /**
         * 微信
         */
        @ConstantName("微信")
        public static final int WXPAY = 0;
        /**
         * 支付宝
         */
        @ConstantName("支付宝")
        public static final int ALIPAY = 1;
        /**
         * 银联
         */
        @ConstantName("银联")
        public static final int UNIONPAY = 2;

        /**
         * 钱包
         */
        @ConstantName("钱包")
        public static final int WALLET = 3;
    }

    /**
     * 积分/亲币模块类型,不要修改值
     */
    public enum IntegralTypeEnum {
        CONSUME(-1L, "消费"),
        CONSUME_CANCLE(11L, "消费退款"),//取消订单，退款，退货
        SING(1L, "签到"),
        LOTTERY(21L, "抽奖"),
        TASK(3L, "转盘任务奖励"),
        COMMENT(4L, "评论"),
        SHARE(5L, "分享"),
        LEAVE_MESSAGE(6L, "留言"),
        Nurse_Experience(7L, "做义工"),
        WATCH_VIDEO(8L, "看视频"),
        RECOMMEND_USER(9L, "推荐他人"),
        REGISTER(10L, "注册"),
        OLD_SYSTEM(12L, "老系统"),
        ;

        public static String getName(long index) {
            for (IntegralTypeEnum c : IntegralTypeEnum.values()) {
                if (c.getIndex() == index) {
                    return c.getName();
                }
            }
            return "";
        }

        private long index;
        private String name;

        private IntegralTypeEnum(long index, String name) {
            this.index = index;
            this.name = name;
        }

        public long getIndex() {
            return index;
        }

        private String getName() {
            return name;
        }
    }

    /**
     * 赚钱还是消费（-1:消费；1:赚钱）
     */
    public static class ConsumeOrMakeMoney {
        public static final int MakeMoney = 1;
        public static final int Consume = -1;
    }

    /**
     * 义工经历状态（1:默认,申请状态；2:申通通过）
     */
    public static class VSDCStates {
        public static final int DEFAULT = 1;
        public static final int PASS = 2;
    }

    /**
     * 加盟申请
     * 审核状态,审核状态(1:待审核 2：审核通过 3：审核拒绝)
     */
    public static class FrancehiseStatus {
        public static final Integer WAITING = 1;
        public static final Integer PASS = 2;
        public static final Integer REFUSE = 3;
    }

    /**
     * 订单类型 或者 评论类型
     * 1：普通商品  2:兑换商品  3：玩 /达人/作品/艺术品   51:住(机构)； 52:机构参观  53：旅游/游学    64:护理培训|培训义工
     * <p>
     * <p>
     * 64 {@link ServiceNurseTraining}
     */
    public static class Order_CommentType {
        @ConstantName("普通商品")
        public static final int GOODS = 1;
        @ConstantName("兑换商品")
        public static final int GOODS_EXCHANGE = 2;
        @ConstantName("玩 /达人/作品/艺术品")
        public static final int ARTWORK = 3;
        //
        @ConstantName("住(机构)")
        public static final int HOURSE = 51;//不做库存
        @ConstantName("机构参观")
        public static final int INSTIBUTION_VISITING = 52;//暂时没有库存
        @ConstantName("旅游/游学")
        public static final int TOUR = 53;//暂时没有库存
        @ConstantName("护理培训|培训义工")
        public static final int SERVICE_NURSE_TRANING = 64;
        /**
         * 判断val是否是在(public static)常量中
         * @param val
         * @return
         */
        public static boolean isConstantVal(long val) {
            return com.web.webstart.base.util.ReflectionUtils.numberInClass(Order_CommentType.class, val);
        }
    }

    /**
     * 搜索模块/分享/收藏
     * (2机构;22住;3商城;4玩;42:作者;游学5;服务公共1;12:家政护理; 13:医疗服务|医疗康复; 14:护理培训|培训义工 15:义工中心)
     * 存储过程中用:pro_home_search
     * int值不能在改变 不能改变
     */
    public static class Search_Share_FavType {
        //1:金融保险 2：智慧传承 3：生前契约 4:医疗服务（医疗康复）
        @ConstantName( "服务公共")
        public static final int SERVICE = 1;
        @ConstantName("家政护理")
        public static final int SERVICE_DOMESITC_NURSING = 12;
        @ConstantName("护理培训|培训义工")
        public static final int NURSE_TRANING = 14;
        @ConstantName("义工中心")
        public static final int NURSE_VSDC = 15;
        @ConstantName("机构")
        public static final int INSTIBUTION = 2;
        @ConstantName("住")
        public static final int HOURSE = 22;
        @ConstantName("商城")
        public static final int GOODS = 3;
        @ConstantName("玩")
        public static final int ARTWORK = 4;
        @ConstantName("作者")
        public static final int ARTWORK_AUTHOR = 42;
        @ConstantName("游学")
        public static final int TOUR = 5;

        /**
         * 判断val是否是在(public static)常量中
         * @param val
         * @return
         */
        public static boolean isConstantVal(long val) {
            return com.web.webstart.base.util.ReflectionUtils.numberInClass(Search_Share_FavType.class, val);
        }
    }

    /**
     * 订单状态
     *
     * @author zhanglin
     *         date: 2015-12-01 16:41:24
     *         //退款;退货;
     *         淘宝:待付款;待发货;待收货;待评价  (4种) 已取消(自动,被动)(交易关闭);已完成(交易完成);
     *         京东:待付款;待发货;待收货;待评价        已取消(自动,被动)(交易关闭);已完成(交易完成);
     *
     *         //酒店;门票/服务
     *         携程:代付款;      未出行;待点评;
     *         美团:代付款;      待使用;待点评;
     *         0:未支付,待支付,代付款;1:已支付(待消费、待发货、待入住);2:待收货(没有物流的没有此状态);3:待评价,已经离店;4: 已评价(已完成)(交易完成);5:已取消--已失效;(自动,被动)(交易关闭)
     *
     *         @see com.web.exiaodao.business.entity.Order
     */
    public static class OrderStatus {
        /**
         * 未支付,待支付,代付款
         */
        public static final int UN_PAY = 0;

        /**
         * 已支付(待消费、待发货、待入住)
         */
        public static final int PAYED = 1;

        /**
         * 待收货;已经发货；(没有物流/服务类)的没有此状态) (服务类订单：（游学/门票、住/酒店、服务的培训义工）)
         */
        public static final int UN_CONSIGNEE = 2;

        /**
         * 待评价,已经使用,已经消费,已经收货
         */
        public static final int UN_COMMENT = 3;

        /**
         * 已评价(已完成)(交易完成)
         */
        public static final int SUCCES_TRADE = 4;

        /**
         * 已取消--已失效;(自动,被动)(交易关闭)
         */
        public static final int CLOSE_TRADE = 5;
    }

    /**
     * 订单退款状态
     *
     * 可以参见：
     * 溜达  ApiRefundOrderController  和  ApiMatchOrderController 活动、赛事取消订单
     * 红宝箱
     *
     * @author changlu
     * @date 2017/1/21 下午10:23
     *
     * 退款（买家已付款）； 退货（卖家已发货）
     * 已经支付---进行退款
     * 已经发货---进行退货
     *
     * @see com.web.exiaodao.business.entity.Order
     *
     * 退款申请已提交-->退款申请已通过/退款审核失败-->退款成功/退款失败
     */
    public static class OrderRefundStatus {
        @ConstantName( "申请中")
        public static final Integer REFUNDING      = 80;
        @ConstantName( "退款中")
        public static final Integer REFUNDSUCESS   = 81;
        @ConstantName( "审核拒绝")
        public static final Integer REFUNDFAIL     = 82;

        //退款成功(淘宝：退款成功，退款不一定到账了,银行的状态（提交银行处理-->银行受理退款-->退款到银行卡）);本app：退款成功，钱已经到账
        @ConstantName( "退款成功")
        public static final Integer REFUND_SUCCESS = 83;
        //退款失败
        @ConstantName( "退款失败")
        public static final Integer REFUND_FAIL    = 84;
    }

    public static class ShortMessageType {
        public static final String SM = "148732";//短信验证码
        public static final String SERVICE_COMMON_SM = "148808";//服务公用
    }

    /**
     *
     * 充值状态,0:待充值(未支付) 1：充值成功（支付成功）  2：充值关闭（后台自动关闭的充值订单）
     * @see WalletRechargeRecord
     */
    public static class WalletRechargeStatus {
        public static final Integer RECHARGE_ING    = 0;
        public static final Integer RECHARGE_SUCESS = 1;
        public static final Integer RECHARGE_CLOSE  = 2;
    }

    /**
     * 提现状态
     * 提现状态,0：提现申请中 1：提现完成  2:提现失败，如账号错误等
     * @see WalletWithdrawRecord
     */
    public static class WalletWithdrawStatus {
        public static final Integer WITHDRAW_ING    = 0;
        public static final Integer WITHDRAW_SUCESS = 1;
        public static final Integer WITHDRAW_CLOSE  = 2;
    }

    /**
     * 交易状态
     * 交易状态,0:交易完成 1：交易进行中（提现需要时间）2：交易关闭(如：提现失败)
     * @see WalletTradeRecord
     */
    public static class WalletTradeStatus {
        public static final Integer TRADE_SUCESS    = 0;
        public static final Integer TRADE_ING       = 1;
        public static final Integer TRADE_CLOSE     = 2;
    }

    /**
     * 交易类型,交易类型(1:充值 2:提现 3:消费 4:佣金分成 5:消费钱包退款 6:提现关闭退款)
     * @see WalletTradeRecord
     */
    public static class WalletTradeType {
        @ConstantName( "充值")
        public static final Integer WALLET_TRADE_RECHARGE          = 1;
        @ConstantName( "提现")
        public static final Integer WALLET_TRADE_WITHDRAW          = 2;
        @ConstantName( "消费")
        public static final Integer WALLET_TRADE_CONSUME           = 3;
        @ConstantName( "佣金分成")
        public static final Integer WALLET_TRADE_COMMISSION        = 4;
        @ConstantName( "消费钱包退款")
        public static final Integer WALLET_TRADE_CONSUME_REFUND    = 5;
        @ConstantName( "提现关闭退款")
        public static final Integer WALLET_TRADE_WITHDRAW_REUND    = 6;
        @ConstantName( "返利")
        public static final Integer WALLET_TRADE_FANLI             = 7;
    }

    /**
     * banner图
     * {@link com.web.exiaodao.remote.vo.BannerVo}
     */
    public static class BannerType {
        public static final int HOME_BANNER = 1;//首页banner
        public static final int TRAVEL = 2;//旅游,游学 游学详情
        public static final int INSTITUTION_HOURSE = 3;//机构房子
        public static final int ARTWORK = 4;//学乐,艺术品
        public static final int TRAVEL_BANNER = 5;//旅游,游学banner
        public static final int GOODS = 6;//商城,商城banner
    }

    /**
     * 分享平台 1:微信 2：微博 3:微信朋友
     */
    public static class SharePlatformType {
        public static final int WEIXIN = 1;//微信
        public static final int WEIXIN_FRIENDS = 2;//微信朋友
        public static final int WEIBO = 3;//微博
        /**
         * 判断val是否是在(public static)常量中
         * @param val
         * @return
         */
        public static boolean isConstantVal(long val) {
            return com.web.webstart.base.util.ReflectionUtils.numberInClass(SharePlatformType.class, val);
        }
    }

    /**
     * 返利状态
     * 0：即将可以（即将可以用返利）(最近下单) 1：已经返利 2：无返利 （已经返利要2个月）
     * @see FanliOrderVo
     * @see FanliOrder
     */
    public static class FanliOrderStatus {
        public static final int RECENT_FANLI_ORDER = 0;//即将可以（即将可以用返利）(最近下单)
        public static final int HAVING_FANLI_ORDER = 1;//已经返利
        public static final int NO_FANLI_ORDER     = 2;//无返利
    }

    //1:可以正常返利 2:返利订单未完成 3:未找到返利订单
    public static class FanliStatus {
        public static final int normal               = 1;//可以正常返利
        public static final int no_complete          = 2;//返利订单未完成
        public static final int not_found_order      = 3;//未找到返利订单
    }

    //所有h5的前缀
    public static String h5Header = "<head><meta name=\\\"viewport\\\" content=\\\"width=device-width, initial-scale=1.0,user-scalable=no\\\"/><style type=\\\"text/css\\\">img,table{max-width: 100% !important;}</style></head> ";
}
